package com.ryskoo.cms.advertpicrel.repository;

import com.ryskoo.cms.advertpicrel.domain.AdvertPicRelPO;
import com.ryskoo.common.constant.CacheConstant;
import com.ryskoo.framework.core.repository.BasicRedisImpl;
import com.ryskoo.framework.core.utils.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Repository;

import javax.annotation.PostConstruct;

/**
 * @author thq
 * @data 2018-05-03
 */
@Primary
@Repository
public class AdvertPicRelRedisImpl extends BasicRedisImpl<AdvertPicRelPO> implements IAdvertPicRelRepository {

    @Autowired
    private RedisUtil redisClient;

    @Autowired
    private IAdvertPicRelRepository advertPicRelRepository;

    @PostConstruct
    public void init() {
        this.setRedisClient(redisClient);
        this.setDao(advertPicRelRepository);
    }

    public AdvertPicRelRedisImpl() {
        super(CacheConstant.CMS_ADVERT_PIC_REL_KEY);
    }

    
	/**
	 * 根据广告Id删除广告图片
	 * @param advertId
	 */
	@Override
	public void deleteByAdvertId(String advertId) {
		advertPicRelRepository.deleteByAdvertId(advertId);
	}
}
